from datetime import date
from datetime import datetime
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.template import Context
from django.template import RequestContext
from django.template import loader
from django.shortcuts import render_to_response
import json
import time
from django.views.decorators.csrf import csrf_exempt

def chat(request):

    

    c = Context({ 'c':'',
                  })
    return render_to_response('chat.html',
                              c,
                              context_instance=RequestContext(request))

@csrf_exempt
def connect(request):
    response_data = [True, {}]
    if request.method == "POST":
        if request.POST['action']=='connect':
            response_data = [True, {'name': 'Guest%d' % time.time() }]
    
    return HttpResponse(json.dumps(response_data))